﻿{include file="public/header" /}

<title>管理员管理</title>
</head>
<body>
<article class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-admin-role-add">
		<div class="row cl">
			<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>角色名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text"  value="{$data.id}" id="id" name="id" style="display: none;">
				<input type="text" class="input-text" value="{$data.title}" placeholder="" id="title" name="title">
			</div>
		</div>
		<div class="row cl">
			
			<label class="form-label col-xs-4 col-sm-3">状  态：</label>
			<div class="formControls col-xs-8 col-sm-9">
				 <div class="radio-box">
				    <input type="radio" value="1" name="status" id="status" {if condition="$data['status'] eq 1 "}checked{/if}>
				    <label for="radio-2">开启</label>
				    <input type="radio" value="2" name="status" id="status" {if condition="$data['status'] eq 2 "}checked{/if}>
				    <label for="radio-2">关闭</label>
				  </div>
			</div>
		</div>
		
		<div class="row cl">
			<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
			<input class="btn btn-primary radius" id='tijiao' type="button" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</article>
{include file="public/footer" /}
<script type="text/javascript">
$('#tijiao').click(function(){
		$.ajax({
				type: 'post',
				data:{
					id	:$('#id').val(),
					title		:$('#title').val(),
					status	:$('input:radio:checked').val()
				},
				url: "{:url('users/admin_role_edit')}" ,
				success: function(data){
					if(data.code == 200) {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						}, function() {
							window.parent.location.reload();
							var index = parent.layer.getFrameIndex(window.name);
							parent.layer.close(index);
						});
					} else {
						layer.msg(data.msg, {
							icon: 1,
							time: 1000
						});
					}
					
				},
                error: function(XmlHttpRequest, textStatus, errorThrown){
					layer.msg('修改失败!',{icon:1,time:1000});
				}
			});
	});
	
</script>